package Ptolemaiosz;

public class Application {

	private Initializer initializer;
	private ViewMode viewMode;
	private Level level;
	private LevelPartManager levelPartManager;
        private Physics physics;

	/**
	 * 
	 * @param level
	 */
        Application()
            {
                SkeletonLogger.logCall();
		
		SkeletonLogger.logReturn();
            }
        
        /*
         *  Vissza kell vezetni a modelbe
         * 
         */
        void setInitializer(Initializer i)
            {
                SkeletonLogger.logCall();
                    this.initializer = i;
                SkeletonLogger.logReturn();
            }
        /*
         * 
         *  Vissza kell vezetni a modellbe
         */
        void setPhysics(Physics p)
            {
                SkeletonLogger.logCall();
		
		SkeletonLogger.logReturn();
                physics = p;
            }
        
        Physics getPhysics()
            {
                SkeletonLogger.logCall();
		
		SkeletonLogger.logReturn();
                return physics;
            }
        
        
	public void setLevel(Level level) {
		SkeletonLogger.logCall();
		
		SkeletonLogger.logReturn();
		
		this.level = level;
	}

	public LevelPartManager getLevelPartManager() {
		
		
		SkeletonLogger.logCall();
		
		SkeletonLogger.logReturn();
		
		return this.levelPartManager;
	}

	/**
	 * 
	 * @param levelPartManager
	 */
	public void setLevelPartManager(LevelPartManager levelPartManager) {
		SkeletonLogger.logCall();
		
		SkeletonLogger.logReturn();
		
		this.levelPartManager = levelPartManager;
	}

	public void nextLevel() {
		SkeletonLogger.logCall();
		
                    initializer.loadNextLevel();
			
		SkeletonLogger.logReturn();
	}

	public void chageViewMode() {
		SkeletonLogger.logCall();
		
		SkeletonLogger.logReturn();
	}

	/**
	 * 
	 * @param direction
	 */
	public void moveAvatar(Direction direction) {
		SkeletonLogger.logCall();
		
			level.getAvatar().getPhysicalEntity().move(direction);
                        
		
		SkeletonLogger.logReturn();
	}

	/**
	 * 
	 * @param direction
	 */
	public void moveLevelPart(Direction direction) {
		SkeletonLogger.logCall();
		
                //Megkerdezzuk a szukseges allapotot
		if(SkeletonController.question("Az alkalmazas mozaik nezetben van?"))
                    {
                        //Ha megfelelo elinditjuak a folyamatot
                        levelPartManager.slide(direction);
                    }
		SkeletonLogger.logReturn();
	}

	public void restartLevel() {
		SkeletonLogger.logCall();
		
                    initializer.restartLevel();
		
		SkeletonLogger.logReturn();
	}

}